Completed
Push — master ( f1fe92...87cf16 )
by Joachim
15:15
created

test.js ➔ getTestDocument   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 8
rs 9.4285
c 1
b 0
f 1
1
const f = require('./index');
2
3
test('check referrer', () => {
4
    let d = getTestDocument();
5
    d.referrer = 'google';
6
7
    const lastClick = f(d);
8
    lastClick.check();
9
    expect(lastClick.getLastClick()).toBe('google');
10
});
11
12
test('check location', () => {
13
    let d = getTestDocument();
14
    d.location.search = '?utm_source=example.com';
15
16
    const lastClick = f(d);
17
    lastClick.check();
18
    expect(lastClick.getLastClick()).toBe('example.com');
19
});
20
21
function getTestDocument() {
22
    return {
23
        referrer: '',
24
        location: {
25
            search: ''
26
        }
27
    };
28
}